from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

semantic_cls = pipeline(Tasks.siamese_uie, 'damo/nlp_structbert_siamese-uie_chinese-base', model_revision='v1.0')
# semantic_cls = pipeline(Tasks.information_extraction, 'damo/nlp_structbert_siamese-uie_chinese-base', model_revision='v1.0')

# 命名实体识别 {实体类型: None}
res = semantic_cls(
    input='1944年毕业于北大的名古屋铁道会长谷口清太郎等人在日本积极筹资，共筹款2.7亿日元，参加捐款的日本企业有69家。',
    schema={
        '人物': None,
        '地理位置': None,
        '组织机构': None
    }
)
print(res)
